/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作
const install = (Vue, vm) => {

	// 参数配置对象
	const config = vm.vuex_config;


	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {

		// 基础服务：登录登出、身份信息、菜单授权、切换系统、字典数据等
		lang: (params = {}) => vm.$u.get('/lang/' + params.lang),
		index: (params = {}) => vm.$u.get(config.adminPath + '/index', params),
		login: (params = {}) => vm.$u.post(config.adminPath + '/login', params),
		logout: (params = {}) => vm.$u.get(config.adminPath + '/logout', params),
		authInfo: (params = {}) => vm.$u.get(config.adminPath + '/authInfo', params),
		menuTree: (params = {}) => vm.$u.get(config.adminPath + '/menuTree', params),
		switchSys: (params = {}) => vm.$u.get(config.adminPath + '/switch/' + params.sysCode),
		dictData: (params = {}) => vm.$u.get(config.adminPath + '/sys/dictData/treeData', params),

		// 易政网单点登录
		ssoToken: (params = {}) => vm.$u.get('/urc/yzw/ssoToken', params),
		sso: (params = {}) => vm.$u.get(`/sso/${params.username}/${params.token}`, {
			relogin: true,
			url: params.url
		}),
		
		wztGetUser: (params = {}) => vm.$u.get('/urc/yzw/getwztUser', params),

		// 账号服务：验证码接口、忘记密码接口、注册账号接口等
		validCode: (params = {}) => vm.$u.getText('/validCode', params),
		getFpValidCode: (params = {}) => vm.$u.post('/account/getFpValidCode', params),
		savePwdByValidCode: (params = {}) => vm.$u.post('/account/savePwdByValidCode', params),
		getRegValidCode: (params = {}) => vm.$u.post('/account/getRegValidCode', params),
		saveRegByValidCode: (params = {}) => vm.$u.post('/account/saveRegByValidCode', params),
		getEmployeeOffices: () => vm.$u.get(config.adminPath + '/getEmployeeOffices'),
		changeLoginOffices(params) {
			return vm.$u.get(config.adminPath +
				`/switchOffice/${params.officeCode}/${params.officeName}/${params.showName}`)
		},
		getLoginOffice: () => vm.$u.get(config.adminPath + '/getModelLoginOffice'),
		// APP公共服务
		upgradeCheck: () => vm.$u.post('/app/upgrade/check', {
			appCode: config.appCode,
			appVersion: config.appVersion
		}),
		commentSave: (params = {}) => vm.$u.post('/app/comment/save', params),
		findListByUserCode: (params = {}) => vm.$u.post(config.adminPath + '/sys/empUser/findListByUserCode',
			params),
		getleftParam: (params = {}) => vm.$u.get(config.adminPath + '/dceconomicindicator/dcEconomicIndicator/getColumn', params),
		getinformation: (params = {}) => vm.$u.get(config.adminPath + '/dceconomicindicator/dcEconomicIndicator/getRank1', params),
		// 个人信息修改
		user: {
			infoSaveBase: (params = {}) => vm.$u.post(config.adminPath + '/sys/user/infoSaveBase', params),
			infoSavePwd: (params = {}) => vm.$u.post(config.adminPath + '/sys/user/infoSavePwd', params),
			infoSavePqa: (params = {}) => vm.$u.post(config.adminPath + '/sys/user/infoSavePqa', params),
		},

		// 员工用户查询
		empUser: {
			listData: (params = {}) => vm.$u.get(config.adminPath + '/sys/empUser/listData', params),
		},

		// 组织机构查询
		// office/treeData
		office: {
			treeData: (params = {}) => vm.$u.get(config.adminPath + '/sys/office/treeData', params),
			treeUnitData: (params = {}) => vm.$u.get(config.adminPath + '/sys/office/treeUnitData', params),
			treeDataByParenCode: (params = {}) => vm.$u.get(config.adminPath +
				'/sys/office/treeDataByParenCode', params),
			treeDataWithMobile: (params = {}) => vm.$u.get(config.adminPath + '/sys/office/treeDataWithMobile',
				params),
		},

		// 增删改查例子
		testData: {
			form: (params = {}) => vm.$u.post(config.adminPath + '/test/testData/form', params),
			list: (params = {}) => vm.$u.post(config.adminPath + '/test/testData/listData', params),
			save: (params = {}) => vm.$u.postJson(config.adminPath + '/test/testData/save', params),
			disable: (params = {}) => vm.$u.post(config.adminPath + '/test/testData/disable', params),
			enable: (params = {}) => vm.$u.post(config.adminPath + '/test/testData/enable', params),
			delete: (params = {}) => vm.$u.post(config.adminPath + '/test/testData/delete', params),
		},
		//任务部署
		taskInfo: {
			// 牵头领导
			getLeader: (params = {}) => vm.$u.post(config.adminPath +
				'/taskdeploy/dcSupTaskInfo/queryLeaderListApp', params),
			//默认督办字号
			msgNum2: (params = {}) => vm.$u.post(config.adminPath + '/taskdeploy/dcSupTaskInfo/getNumber',
				params),
			//部署审核
			sh: (params = {}) => vm.$u.post(config.adminPath + '/audit/dcSupTaskAudit/queryAuditInfoListApp',
				params),
			save: (params = {}) => vm.$u.post(config.adminPath + '/taskdeploy/dcSupTaskInfo/save', params),
			list: (params = {}) => vm.$u.post(config.adminPath +
				'/taskdeploy/dcSupTaskInfo/queryListData?taskStatus=0&normalFlag=1', params),
			hs: (params = {}) => vm.$u.postJson(config.adminPath + '/audit/dcSupTaskAudit/save', params),
			getDict: (params = {}) => vm.$u.postJson(config.adminPath + '/dict/dcSupTaskInfoDict/queryDictList',
				params),
			getYear: (params = {}) => vm.$u.postJson(config.adminPath + '/dict/dcSupTaskInfoDict/queryYearList',
					params),

		},
		//任务接收
		taskReceive: {
			list: (params = {}) => vm.$u.post(config.adminPath +
				'/audit/taskReceive/listData', params),
			form: (params = {}) => vm.$u.post(config.adminPath + '/audit/taskReceive/listData', params),
			receive: (params = {}) => vm.$u.post(config.adminPath + '/audit/taskReceive/receive', params),
			instructions: (params = {}) => vm.$u.post(config.adminPath + '/audit/taskReceive/instructions',
				params),
			getActionById: (params = {}) => vm.$u.post(config.adminPath + '/action/dcSupTaskAction/getActionById', params),
				
		},
		//任务反馈
		taskFeedback: { //这里=空没问题
			list: (params = {}) => vm.$u.post(config.adminPath + '/audit/taskReceive/listData?remarks=2',
				params),
			listDetail: (params = {}) => vm.$u.post(config.adminPath +
				'/feedback/dcSupTaskFeedback/feedbacklistData', params),
			form: (params = {}) => vm.$u.post(config.adminPath + '/audit/taskReceive/listData', params),
			formDetail: (params = {}) => vm.$u.post(config.adminPath + '/audit/taskReceive/formDetail', params),
			formInfo: (params) => vm.$u.post(config.adminPath + '/audit/taskReceive/formInfo?taskId=' + params),
			feedback: (params = {}) => vm.$u.post(config.adminPath + '/audit/taskReceive/feedback', params),
		},
		//反馈审核
		auditFeedback: {
			list: (params = {}) => vm.$u.post(config.adminPath + '/audit/dcSupTaskAudit/queryAuditInfoListApp',
				params),
			listFeedback: (params = {}) => vm.$u.post(config.adminPath +
				'/audit/dcSupTaskAudit/queryAuditFeedbackListApp', params),
			save: (params = {}) => vm.$u.postJson(config.adminPath + '/audit/dcSupTaskAudit/save', params),

		},
		//整理审核
		auditArrange: {
			list: (params = {}) => vm.$u.post(config.adminPath +
				'/audit/dcSupTaskAudit/listData?auditType=arrange&auditStatus=1', params),
			form: (params = {}) => vm.$u.post(config.adminPath +
				'/audit/dcSupTaskAudit/queryAuditArrangeFormApp', params),
			save: (params = {}) => vm.$u.postJson(config.adminPath + '/audit/dcSupTaskAudit/save', params),

		},
		//任务台账
		taskAccount: {
			list: (params = {}) => vm.$u.post(config.adminPath + '/query/ComPreHenceQuery/list', params),
			detailInfo: (params = {}) => vm.$u.get(config.adminPath +
				'/home/homePage/taskDetailInfoApp?taskId=' + params),
			getPage: (params = {}) => vm.$u.get(config.adminPath + '/home/homePage/queryStatus', params),
			
			// 查看任务进度反馈接口
			taskInfoActionListApp: (params = {}) => vm.$u.post(config.adminPath + '/home/homePage/taskInfoActionListApp', params),
			// 查看具体任务进度反馈接口
			taskInfoFeedbackListApp: (params = {}) => vm.$u.post(config.adminPath + '/home/homePage/taskInfoFeedbackListApp', params),
			// 查看具体任务其他接口
			taskInfoOtherApp: (params = {}) => vm.$u.post(config.adminPath + '/home/homePage/taskInfoOtherApp', params),
			// 查看具体任务进展接口
			taskInfoProgressApp: (params = {}) => vm.$u.post(config.adminPath + '/home/homePage/taskInfoProgressApp', params),
		},
		//消息
		message: {
			list: (params = {}) => vm.$u.post(config.adminPath + '/msg/listData', params),
			list2: (params = {}) => vm.$u.post(config.adminPath + '/backlog/dcSupBacklog/getPage', params),
			detail: (params = {}) => vm.$u.post(config.adminPath + '/backlog/dcSupBacklog/detail', params),
			readMsg: (params = {}) => vm.$u.post(config.adminPath + '/msg/readMsg', params),
			getDetail: (params = {}) => vm.$u.post(config.adminPath + '/msg/msgInner/get', params),

		},
		//待办已办任务
		task: {
			noCompleteList: (params = {}) => vm.$u.post(config.adminPath +
				'/action/dcSupTaskAction/noCompleteListData', params),
			completeList: (params = {}) => vm.$u.post(config.adminPath +
				'/action/dcSupTaskAction/completeListData', params),
		},
		// 通知公告
		notice: {
			list: (params = {}) => vm.$u.post(config.adminPath + '/msg/msgInner/listData', params),
			getDetail: (params = {}) => vm.$u.post(config.adminPath + '/msg/msgInner/get', params),
		},
		// 市领导工作台

		homePage: {
			queryWorkList: (params = {}) => vm.$u.post(config.adminPath + '/home/homePage/queryWorkList',
				params),
			getSave: (params = {}) => vm.$u.post(config.adminPath + '/home/homePage/save', params),
			// 查询市领导首页的批示
			queryExplainList: (params = {}) => vm.$u.post(config.adminPath + '/home/homePage/explainData',
				params),
		},
		//督办追踪
		taskTrace: {
			list: (params = {}) => vm.$u.post(config.adminPath + '/home/homePage/queryWorkList', params),
			auditTask: (params = {}) => vm.$u.post(config.adminPath + '/home/homePage/save', params),
			getDetailInfo: (params = {}) => vm.$u.get(config.adminPath +
				'/taskdeploy/dcSupTaskInfo/detailForm?id=' + params),
			getActionFeedback: (params = {}) => vm.$u.get(config.adminPath +
				'/taskdeploy/dcSupTaskInfo/getActionFeedback?id=' + params),
			cuiban: (params = {}) => vm.$u.get(config.adminPath + '/audit/taskReceive/cuiban2?id=' + params)
		},
		//专项工作
		doWork: {
			querySeven: (params = {}) => vm.$u.post(config.adminPath + '/home/supIndex/querySeven?taskYear=' +
				params),
			getRank: (params = {}) => vm.$u.get(config.adminPath + '/home/provinceMajor/getRank')
		},

		// 展示附件接口
		getAnnex: {
			fileList: (params = {}) => vm.$u.get(config.adminPath + '/file/fileList', params)
		}
	};

}

export default {
	install
}
